package ooday004;

public class Test {
    public static void main(String[] args) {
Animal[] animals=new  Animal[5];
animals[0]=new Dog("小黑",1,"黑") ;
animals[1]=new Dog("小白",2,"白");
animals[2]=new Fish("小紫",1,"紫");
animals[3]=new Fish("小蓝",1,"蓝");
animals[4]=new Chick("小金",3,"金");
for(int i=0;i< animals.length;i++){
    System.out.println(animals[i].name);
    animals[i].eat();
    animals[i].drink();

    if(animals[i] instanceof Dog){
        Dog dog=(Dog) animals[i];
        dog.lookHome();
        dog.Swim();

    }

    if(animals[i] instanceof Dog){
       Chick chick=(Chick) animals[i];
        chick.layEggs();


    }

    if(animals[i] instanceof Fish){
       Fish fish=(Fish) animals[i];
         fish.Swim();


    }


}

Master master =new  Master();
    Dog dog=new Dog("小黑",1,"黑") ;
    Fish fish=new Fish("小紫",2,"紫");
    Chick chick=new Chick("小金",3,"金");
    master.feed(dog);
    master.feed(fish);
    master.feed(chick);






    }
}
